home *** CD-ROM | disk | FTP | other *** search
/ TPUG - Toronto PET Users Group / TPUG Users Group CD / TPUG Users Group CD.iso / AMIGA / AMICUS / AMICUS04.ADF / image.ed / dosrequest.c < prev    next >
C/C++ Source or Header  |  1985-10-26  |  6KB  |  153 lines

  1.  
  2. /************* dos.requester.c **********/
  3.  
  4.  
  5. #include "intuall.h"
  6. #include "imageedit.h"
  7.  
  8.  
  9. struct Requester dosrequest;
  10. struct IntuiText dosreqtext[3]; /* dos requester text */
  11. struct IntuiText dostext[2];    /* dos gadget text */
  12.  
  13. extern struct TextAttr TestFont;
  14.  
  15. BYTE dosname[20];
  16. BYTE undobuff[20];
  17.  
  18.  
  19. /* this is the definition of the string gadget used for the dos requester */
  20.  
  21. struct StringInfo stringstuff = {
  22.         &dosname[0],                    /* default and final string */
  23.         &undobuff[0],                   /* optional undo buffer (later) */
  24.         0,                              /* character position in buffer */
  25.         20,                             /* max characters in buffer */
  26.         0,                              /* buffer position of first displayed
  27.                                          * character */
  28.         0,0,0,0,0,NULL,0 };             /* intuition local variables */
  29.  
  30. /* the cancel gadget lets people decide not to load or save */
  31.  
  32. struct Gadget CancelGadget = {
  33.         NULL,                           /* address of next gadget */
  34.         100,50,48,10,                   /* left,top,width,height of hitbox */
  35.         GADGHCOMP,                      /* flags */
  36.         RELVERIFY | GADGIMMEDIATE | ENDGADGET,  
  37.                                         /* tell me only when he releases the
  38.                                          * mouse button and if over the
  39.                                          * gadget at that time */       
  40.         REQGADGET | BOOLGADGET, /* is a requestor, string */
  41.         NULL,                           /* BORDER descriptor */
  42.         NULL,                           /* SELECT descriptor */
  43.         &dostext[0],                    /* CANCEL */
  44.         0,                              /* mutual exclusion (could use) */
  45.         NULL,                           /* special info */
  46.         DISKRWGADGETS+0,                /* gadget identifier, user */
  47.         NULL };                         /* user data pointer */
  48.  
  49. /* the string gadget is supposed to pick up a file name for load and save */
  50.  
  51. struct Gadget DosNameGadget = {
  52.         &CancelGadget,                  /* address of next gadget */
  53.         20,26,140,10,                   /* left,top,width,height of hitbox */
  54.         GADGHCOMP,                      /* Flags, complement mode, needed
  55.                                          * as of this writing for string
  56.                                          * gadgets  */
  57.         RELVERIFY | GADGIMMEDIATE | ENDGADGET,  
  58.                                         /* Activation flags, when user hits
  59.                                          * return, terminates
  60.                                          * input and deselects gadget */
  61.         REQGADGET | STRGADGET,          /* is a requestor, string */
  62.         NULL,                           /* BORDER descriptor */
  63.         NULL,                           /* SELECT descriptor */
  64.         NULL,                           /* intiutext to write there */
  65.         0,                              /* mutual exclusion (could use) */
  66.         &stringstuff,                   /* special info */
  67.         DISKRWGADGETS+1,                /* identifier, user */
  68.         NULL };                         /* user data pointer */
  69.  
  70. /* this one is only temporary.... string gadget is not transmitting GADGETUP
  71.  * when RETURN is hit (I THINK).  So I want to add a gadget which will 
  72.  * definitely let me exercise my code for load and save */
  73.                 
  74. struct Gadget LoadSaveGadget = {
  75.         &DosNameGadget,                 /* address of next gadget */
  76.         5,50,40,10,                     /* left,top,width,height of hitbox */
  77.         GADGHCOMP,                      /* flags */
  78.         RELVERIFY | GADGIMMEDIATE | ENDGADGET,  
  79.                                         /* tell me only when he releases the
  80.                                          * mouse button and if over the
  81.                                          * gadget at that time */       
  82.         REQGADGET | BOOLGADGET, /* is a requestor, string */
  83.         NULL,                           /* BORDER descriptor */
  84.         NULL,                           /* SELECT descriptor */
  85.         &dostext[1],                    /* load or save */
  86.         0,                              /* mutual exclusion (could use) */
  87.         NULL,                           /* special info */
  88.         DISKRWGADGETS+1,                /* gadget identifier, user */
  89.                 /* has same gadget id so either click load/save or
  90.                  * type name and hit return starts the operation. */
  91.  
  92.         NULL };                         /* user data pointer */
  93.  
  94. InitDosRequest()
  95. {
  96.         InitRequester(&dosrequest);
  97.         dosrequest.LeftEdge = 20;
  98.         dosrequest.TopEdge = 20;
  99.         dosrequest.Width = 230;
  100.         dosrequest.Height = 64;
  101.         dosrequest.ReqGadget = &LoadSaveGadget;
  102.         dosrequest.ReqText = &dosreqtext[0];    
  103.         dosrequest.BackFill = 1;
  104.  
  105.         dosreqtext[0].FrontPen = 0;
  106.         dosreqtext[0].BackPen = 1;
  107.         dosreqtext[0].DrawMode = JAM1;
  108.         dosreqtext[0].ITextFont = &TestFont;
  109.         dosreqtext[0].NextText = &dosreqtext[1];
  110.         dosreqtext[0].LeftEdge = 5;
  111.         dosreqtext[0].TopEdge = 40;
  112.         dosreqtext[0].IText = "Press Return To Begin";
  113.  
  114.         dosreqtext[1].FrontPen = 0;
  115.         dosreqtext[1].BackPen = 1;
  116.         dosreqtext[1].DrawMode = JAM1;
  117.         dosreqtext[1].ITextFont = &TestFont;
  118.         dosreqtext[1].NextText = &dosreqtext[2];
  119.         dosreqtext[1].LeftEdge = 5;
  120.         dosreqtext[1].TopEdge = 13;
  121.         dosreqtext[1].IText = "Type Name:";
  122.  
  123.         dosreqtext[2].FrontPen = 0;
  124.         dosreqtext[2].BackPen = 1;
  125.         dosreqtext[2].DrawMode = JAM1;
  126.         dosreqtext[2].ITextFont = &TestFont;
  127.         dosreqtext[2].NextText = NULL;
  128.         dosreqtext[2].LeftEdge = 5;
  129.         dosreqtext[2].TopEdge = 1;
  130.         dosreqtext[2].IText = "Click In Name Area";
  131.  
  132.         return;
  133. }
  134.  
  135. InitDosText()
  136. {
  137.         SHORT n;
  138.         for(n=0; n<2; n++)
  139.         {
  140.         dostext[n].FrontPen = 1;
  141.         dostext[n].BackPen = 0;
  142.         dostext[n].DrawMode = JAM2;
  143.         dostext[n].ITextFont = &TestFont;
  144.         dostext[n].NextText = NULL;
  145.         dostext[n].LeftEdge = 0;
  146.         dostext[n].TopEdge = 2;
  147.         }
  148.         dostext[0].IText = "CANCEL";
  149.         dostext[1].IText = NULL;        /* filled in at Event3.c, as 
  150.                                          * Load or Save */
  151.         return;
  152. }
  153.